﻿<%@page import="java.util.*" %>
<%
  
  
  List userRole=(List)request.getAttribute("userrole");  
  
  String roleId=request.getParameter("roleId");  
%>   

	
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="角色权限">  
    <meta name="description" content="角色权限">  
    <title>角色权限管理</title>  
    
    <%@ include file="/WEB-INF/inc/default.jsp"%>
    <jsp:include page="/WEB-INF/inc/dic.jsp"/>

</head>  
<body>  
    
    <div style="margin:10px 0;">
        <a href="#" class="easyui-linkbutton" onclick="save()">保存</a> 
        
    
    </div>
    <ul id="tt" class="easyui-tree" data-options="url:'/auth/systemRole/roleresourcelist.do?roleId=<%=roleId%>',method:'get',animate:true,checkbox:true"></ul>
    <script type="text/javascript">   
       var url='/auth/systemUser/userrolesave.do';
    
   
     function getChecked(){
            var nodes = $('#tt').tree('getChecked');
            var s = '';
            for(var i=0; i<nodes.length; i++){
                if (s != '') s += ',';
                s += nodes[i].id;
            }
            //alert(s);
            return s;
        }
     function save(){
     	    var datas=getChecked();
     	    
     	    $.post('/auth/systemRole/setroleresources.do',{roleId:<%=roleId%>,resources:datas},function(result){  
               if (result.success){  
                  // $('#dg').datagrid('reload');    // reload the user data  
                  alert(result.msg);
               } else {  
                    
                 //  $.messager.alert('错误',result.errorMsg,'error'); 
                 alert(result.msg);  
               }  
           },'json');
      }	   
    </script>
     
     
     
</body>  
</html>